<?php
/**
 * Created by JetBrains PhpStorm.
 * User: xiaobai
 * Date: 13-5-24
 * Time: 上午10:18
 * To change this template use File | Settings | File Templates.
 */
class Crawl_log_model extends CI_Model {

    private $_write_db;
    private $_project;
    function __construct()
    {
        parent::__construct();
        $this->load->library('error_code_library');
        $this->_write_db = $this->load->database('master', TRUE);
        $this->_project = $this->config->item('project');
    }

    public function create_cral_log($data) {
        $table_name = $this->get_tabel_name();
        $data['curl_return'] = isset($data['curl_return']) ? mysql_real_escape_string(trim($data['curl_return'])) : NULL;
        $this->_write_db->insert($table_name, $data);
    }

    public function get_tabel_name() {
        $data_tag = date("_Y_m_d");
        return $table_name = 'crawl_log_'.$this->_project.$data_tag;
    }
}